<!-- 优惠券 -->
<style>
/*样式一*/
.coupon-all{height: 90px;padding: 10px 0 0 0;background: #fff;margin-bottom: 0;white-space: nowrap;overflow-y: auto;}
.coupon-all::-webkit-scrollbar {display: none;}
.coupon-all .coupon{width: 160px;height: 80px;background: red;margin-left: 10px;border-radius: 5px;display: inline-block;position: relative;top: 0;}
.coupon-all .coupon p{position: absolute;z-index: 5;font-size: 20px;color: #fff;margin-left: 15px;line-height: 80px;}
.coupon-all .coupon p span{font-size: 14px;}
.coupon-all .coupon img.background_img{max-height: 100%;max-width: 100%;position: absolute;z-index: 1;}
.coupon-all .coupon img.already_received{max-height: 60%;max-width: 60%;position: absolute;z-index: 10;display: none;}
.coupon-all .coupon:last-child{margin-right: 10px;}

/*样式二*/
.coupon-all2{padding: 5px 0 5px;background: #fff;overflow: hidden;}
.coupons-style2 {width: 31.33%;height: 75px;display: inline-block;float: left;background: #f23c3c url("__TEMP__/{$style}/public/images/index_coupon_bg.png") no-repeat;background-size: 100% 100%;margin:0 0 1.5% 1.5%;color: #fff;text-align: center;}
.coupons-style2 .money-number {display: block;margin: 0;padding-top: 8px;line-height: 22px;font-size: 21px;color: #fff;text-align: center;}
.coupons-style2 .explanation {display: block;margin: 0;font-size: 12px;color: rgba(255, 255, 255, .7);text-align: center;}
.coupons-style2 .get {font-size: 12px;position: relative;color: rgba(255, 255, 255, .7);}
</style>

{if condition="$custom_template_v.style_data.coupons.style==1"}
<div class="coupon-all">
	{volist name="coupon_list" id="vo" }
	{if condition="$vo['money'] gt 0 && $vo['money'] elt 10"}
		<div class="coupon" style="background: #FFA72A;" onclick="coupon_receive(this,{$vo.coupon_type_id})">
	{elseif condition="$vo['money'] gt 10 && $vo['money'] elt 100"}
		<div class="coupon" style="background: #FF4D5B;" onclick="coupon_receive(this,{$vo.coupon_type_id})">
	{elseif condition="$vo['money'] gt 100"}
		<div class="coupon" style="background: #34D71E;" onclick="coupon_receive(this,{$vo.coupon_type_id})">
	{/if}
		<img src="__STATIC__/wapCustomTemplate/images/index_coupon.png" class="background_img">
		<p><span>￥</span>{$vo.money}</p>
		<img src="__STATIC__/wapCustomTemplate/images/already_received.png" class="already_received">
	</div>
	{/volist}
</div>
{elseif condition="$custom_template_v.style_data.coupons.style==2"}
<div class="coupon-all2">
	{volist name="coupon_list" id="vo"}
	<div class="coupons-style2" onclick="coupon_receive(this,{$vo.coupon_type_id})">
		<span class="money-number">￥{$vo.money}</span>
		<p class="explanation">满{$vo.at_least}可用</p>
		<span class="get">领取</span>
	</div>
	{/volist}
</div>
{/if}

<script type="text/javascript">
// var is_have = true;
function coupon_receive(event,coupon_type_id){

	location.href = __URL(APPMAIN+"/goods/getCoupon?coupon_type_id="+coupon_type_id);
// 	if(is_have){
// 		is_have = false;
// 		$.ajax({
// 			type:"post",
// 			url : "{:__URL('APP_MAIN/index/getCoupon')}",
// 			async: false,
// 			dataType:"json",
// 			data:{ 'coupon_type_id' : coupon_type_id },
// 			success : function(data){
// 				if(data['code']>0){
// 					showBox("恭喜您，领取成功！");
// 					$(event).children(".already_received").show();
// 				}else if(data['code'] == -2009){
// 					location.href="{:__URL('APP_MAIN/login/index')}";
// 				}else{
// 					showBox(data['message']);
// 					is_have = true;
// 				}
// 			}
// 		})
// 	}
}
</script>